﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Yipusoft.BaseDoc;

public partial class Task_BaseDoc_DocView : System.Web.UI.Page
{

    BaseDocDataContext db = new BaseDocDataContext();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            init();
        }
    }

    void init()
    {
        if (Request["ID"] != null)
        {
            Guid Id = new Guid(Request["ID"]);
            BaseDocs doc = (from p in db.BaseDocs where p.ID == Id select p).FirstOrDefault();
            lblCaption.Text = doc.Caption;

            List<BaseDocFiles> files = doc.BaseDocFiles.ToList();
            foreach (BaseDocFiles file in files)
            {
                lblFile.Text += "<div class=file> <img src='../../Images/attachment.gif' alt=''> <a href='../../Document/" + doc.SetDepartment + "/" + file.FileName + "' target=_blank>" + file.FileTitle + "</a></div>";
            }
        }
    }
}
